package com.car.dal.dao.vote;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.car.bean.GridObj;
import com.car.bean.OrderObj;
import com.car.bean.PageObj;
import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.JsVote;
import com.car.util.Page;

public class JsVoteDaoImpl extends IbatisCommonDao<JsVote, Long> implements JsVoteDao {

	public GridObj GetList(JsVote vote, PageObj pageObj) {
		OrderObj order = new OrderObj();
		order.setDir("desc");
		order.setSort("id");
		// TODO Auto-generated method stub
		return super.findByPage(vote, pageObj, order);
	}

	public Integer getVoteCountByLikeCity(JsVote vote) {
		return this.queryForInteger("getVoteCountByLikeCity", vote);
	}
	
	public Integer getVoteCountByLikeDdzx(JsVote vote) {
		return this.queryForInteger("getVoteCountByLikeDdzx", vote);
	}
	
	public Integer getVoCountByType(JsVote vote) {
		return this.queryForInteger("getVoCountByType", vote);
	}
	
	//三张表合并后显示的数据
	public List<JsVote> getVolistByTypeNew(JsVote vote,Page page) {
		vote.setFirstrownum(page.getFirstrownum());
		vote.setPagesize(page.getPagesize());
		List<JsVote> list=this.queryForEntityList(JsVote.class,"getVolistByTypeNew", vote);
		return list;
	}
	
	
	public List<JsVote> getVolistByType(JsVote vote,Page page) {
		vote.setFirstrownum(page.getFirstrownum());
		vote.setPagesize(page.getPagesize());
		List<JsVote> list=this.queryForEntityList(JsVote.class,"getVolistByType", vote);
		return list;
	}

	public List<JsVote> getVolistAnswer(JsVote vote) {
		List<JsVote> list = this.queryForEntityList(JsVote.class,"getVolistAnswer",vote);
		return list;
	}
	
	public List<JsVote> getVoteTjiByType(JsVote vote) {
		List<JsVote> list = this.queryForEntityList(JsVote.class,"getVoteTjiByType",vote);
		return list;
	}

	
	public Integer getVoteTjiByType2(JsVote vote) {
		return this.queryForInteger("getVoteTjiByType2", vote);
	}

	@Override
	public Integer getVoCountMarket(JsVote vote) {
		return this.queryForInteger("getVoCountMarket", vote);
	}

	@Override
	public List<JsVote> getVolistMarket(JsVote vote, Page page) {
		vote.setFirstrownum(page.getFirstrownum());
		vote.setPagesize(page.getPagesize());
		List<JsVote> list=this.queryForEntityList(JsVote.class,"getVolistMarket", vote);
		return list;
	}

	@Override
	public Integer getTrackings(String keyname) {
		Map<String, Object> args = new HashMap<String, Object>();
		args.put("keyname", keyname);
		return	queryForInteger("getTrackings", args);
	}

	@Override
	public Integer limitIP(JsVote vote) {
		return this.queryForInteger("limitIP", vote);
	}

	@Override
	public Integer getVoSpcodeCountByType(JsVote vote) {
		return this.queryForInteger("getVoSpcodeCountByType", vote);
	}

	@Override
	public List<JsVote> getVoSpcodelistByType(JsVote vote, Page page) {
		vote.setFirstrownum(page.getFirstrownum());
		vote.setPagesize(page.getPagesize());
		List<JsVote> list=this.queryForEntityList(JsVote.class,"getVoSpcodelistByType", vote);
		return list;
	}

	@Override
	public Integer getVoCountByTypeNew(JsVote vote) {
		return this.queryForInteger("getVoCountByTypeNew", vote);
	}

	@Override
	public List<String> getVoteTjiByType3(JsVote vote) {
		@SuppressWarnings("unchecked")
		List<String> bbb = queryForList("getVoteTjiByType3", vote);
		return bbb;
	}

	@Override
	public Integer getVoteTjiByType_sum(JsVote vote) {
		return this.queryForInteger("getVoteTjiByType_sum", vote);
	}

	@Override
	public List<String> getVoteTjiByType_chongFu(JsVote vote) {
		@SuppressWarnings("unchecked")
		List<String> chongFu = queryForList("getVoteTjiByType_chongFu", vote);
		return chongFu;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<String> getVoteTj_New(JsVote vote) {
		return queryForList("getVoteTj_New", vote);
	}
	/**
	 * 获取当天的某一个电话 只能有一条预约数据
	 */
	@Override
	public Integer getNowDayCount_ByPhone(String phone,long cdate_start,long cdate_end) {
		JsVote vote = new JsVote();
		vote.setPhone(phone);
		vote.setCdate_start(cdate_start);
		vote.setCdate_end(cdate_end);
		return this.queryForInteger("getNowDayCount_ByPhone", vote);
	}

	
	
}
